'use strict';

define(['angular'], function (angular) {
    angular.module('myApp.controllers', [])
        .controller('AppController', ['$scope', 'Item', function ($scope, Item) {
            $scope.awesomeThings = [
                'HTML5 Boilerplate',
                'AngularJS',
                'Karma'
            ];
            $scope.items = [];
            var item1 = {"checked": false, "description": "aaa"};
            $scope.items.push(item1);
            var item2 = {"checked": false, "description": "bbb"};
            $scope.items.push(item2);


            //Item.query(function (response) {
            //    $scope.items = response ? response : [];
            //});
            //
            //$scope.addItem = function (description) {
            //    new Item({
            //        description: description,
            //        checked: false
            //    }).$save(function (item) {
            //            $scope.items.push(item);
            //        });
            //    $scope.newItem = "";
            //};
            //
            //$scope.updateItem = function (item) {
            //    item.$update();
            //};
            //
            //$scope.deleteItem = function (item) {
            //    item.$remove(function () {
            //        $scope.items.splice($scope.items.indexOf(item), 1);
            //    });
            //};
        }]);
});


